<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">


	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<p:growl></p:growl>
			<h:panelGrid>

			<h:outputText value="New Resource" styleClass="outputTextTitle" />
			<h:panelGrid columns="3">
				<h:outputLabel value="#{msg['modulename.label']} " />
				<h:outputLabel value=" : " />
				<p:selectOneMenu value="#{createResourceBean.selectedModuleId}" styleClass="adminSelectOneMenuWidth" style = "width:136px;">
					<f:selectItems value="#{createResourceBean.modulesMap}" />
				</p:selectOneMenu>

				<h:outputLabel value="#{msg['resourcename.label']} " />
				<h:outputLabel value=" : " />
				<p:inputText value="#{createResourceBean.resource.resourceName}" />

				<h:outputLabel value="#{msg['filename.label']} " />
				<h:outputLabel value=" : " />
				<p:inputText value="#{createResourceBean.resource.fileName}" />

				<h:outputLabel value="#{msg['displayname.label']}" />
				<h:outputLabel value=" : " />
				<p:inputText value="#{createResourceBean.resource.displayName}" />

				<h:outputLabel value="#{msg['description.label']} " />
				<h:outputLabel value=" : " />
				<p:inputTextarea value="#{createResourceBean.resource.description}" />
			</h:panelGrid>
			
			<p:commandButton value="Add another resource" action="#{createResourceBean.createAnotherResourceAction}" update="@form"/>
			
			<h:panelGrid style="width: 100%; text-align: left; padding-top: 10px;" rendered="#{createResourceBean.renderResourceTable}" >
				<h:outputText value="Unsaved Resources" styleClass="outputTextSubTitle" />
				<p:dataTable value = "#{createResourceBean.resources}" var = "row">
					<p:column>
						<f:facet name="header">
							<h:outputText value="Resource Name" />
						</f:facet>
						<h:outputText value="#{row.resourceName}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="File Name" />
						</f:facet>
						<h:outputText value="#{row.fileName}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Display Name" />
						</f:facet>
						<h:outputText value="#{row.displayName}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Description" />
						</f:facet>
						<h:outputText value="#{row.description}" />
					</p:column>
					<p:column>
					</p:column>
				</p:dataTable>
				
			</h:panelGrid>
			<p:commandButton value="Save Resource(s)" action="#{createResourceBean.saveResourceAction}" update="@form"/>
</h:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>

